<?php 

	class Page extends CI_Model
	{
		public function __construct()
		{
			parent::__construct();
		}

		function getPage($id = false)
		{
			$query = $this->db->get_where('pages',array('id'=>$id));
			return $query->row_array();
		}

		function getAll()
		{
			$query = $this->db->get('pages');
			return $query->result_array();
		}

		function addNewPage($data)
		{
			return $this->db->insert('pages',$data);
		}

		function updatePage($data,$id = false)
		{
			$this->db->where('id',$id);
			return $this->db->update('pages',$data);			
		}

		function getPageContent($title = false)
		{
			$this->db->select('*');
			$this->db->from('pages');
			$this->db->where('name',$title);
			$query = $this->db->get();

			return $query->row_array();
		}
	}